<html>
<head><meta charset="utf-8"><title>Reason for in-tree LLVM? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html">Reason for in-tree LLVM?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181934535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181934535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181934535">(Nov 26 2019 at 15:49)</a>:</h4>
<p>Hi all. I'm trying to make it faster to re-build rustc after a <code>./x.py clean</code> (or <code>git clean -xfd</code> etc.). rustc guide shows a way to use system LLVM which I haven't tried it yet, but I'm wondering why we need to build LLVM from source if standard LLVM dists work. I think rustc guide doesn't say. Can I always use LLVM 7 to bootstrap rustc, or are there any features that won't work or tests that fail if I do that?</p>
<p>(Sorry if this is not the right place for this question! Let me know if that's the case and I'll ask elsewhere)</p>



<a name="181934557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181934557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181934557">(Nov 26 2019 at 15:49)</a>:</h4>
<p>I'm using llvm9 and it works</p>
<p>Edit: just for future references this is 9.0.0 exactly</p>



<a name="181934626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181934626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181934626">(Nov 26 2019 at 15:50)</a>:</h4>
<p>you can set it in <code>config.toml</code> there is a field with the <code>llvm-config</code> path</p>



<a name="181934838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181934838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181934838">(Nov 26 2019 at 15:52)</a>:</h4>
<p>Thanks. I have LLVM 8 installed and I'm trying with that currently. The question mainly is what do I lose by using system LLVM instead of in-tree.</p>



<a name="181935139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181935139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181935139">(Nov 26 2019 at 15:54)</a>:</h4>
<p>Hmm, I'm getting</p>
<div class="codehilite"><pre><span></span>thread &#39;main&#39; panicked at &#39;FileCheck executable &quot;/usr/lib/llvm-8/bin/FileCheck&quot; does not exist&#39;, src/bootstrap/sanity.rs:167:9
</pre></div>



<a name="181935253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181935253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181935253">(Nov 26 2019 at 15:55)</a>:</h4>
<p>NVM fixed.</p>



<a name="181936643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181936643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181936643">(Nov 26 2019 at 16:08)</a>:</h4>
<p>We have a couple of patches in our fork of LLVM that are rust specific. Sometimes they can be critical for Rust to produce working machine code while we wait for upstream to catch up</p>



<a name="181936685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181936685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181936685">(Nov 26 2019 at 16:08)</a>:</h4>
<p>but currently its just a few patches that e.g. enable dead allocations to be removed by making llvm know about our symbol names.</p>



<a name="181937245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181937245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181937245">(Nov 26 2019 at 16:13)</a>:</h4>
<p>OK, thanks. Do we have a specified LLVM version that's supposed to work when booting rustc? Or is only the in-tree one is officially supported? I'm currently trying with LLVM 8 but build fails when building <code>rustc_llvm</code>.</p>



<a name="181937730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181937730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181937730">(Nov 26 2019 at 16:18)</a>:</h4>
<p>we used to support back to LLVM 6 back when we needed emscripten to work, but now that it is no longer the case, I believe the only version we actively maintain support for is the in-tree one. The same release of external LLVM should in most cases still work.</p>



<a name="181937884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181937884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181937884">(Nov 26 2019 at 16:20)</a>:</h4>
<p>I suppose that an alternative is having the llvm repository locally, build it and point to it in the <code>config.toml</code>. You can rebuild it once in a while</p>



<a name="181949695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181949695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181949695">(Nov 26 2019 at 18:30)</a>:</h4>
<p>FWIW we do have a CI builder that tests on Linux with LLVM 6, so it should not break at least on that platform. I don't expect we'll get rid of that any time soon, either, since some Linux distros package rustc with their system LLVM instead of our fork.</p>



<a name="181952516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reason%20for%20in-tree%20LLVM%3F/near/181952516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reason.20for.20in-tree.20LLVM.3F.html#181952516">(Nov 26 2019 at 18:59)</a>:</h4>
<p>Update: I was able to build rustc with LLVM 9 (failed to build with 7 and 8).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>